package _021_11_19

func back(nums []int, idx int, path []int, lastMax int, nowRow int, canJoin *bool, ret *[][]int) {

	for i := idx; i < len(nums); i++ {
		if nowRow == 0 {
			*canJoin = true
		}
		if nums[i] > lastMax {
			path = append(path, nums[i])
			back(nums, i+1, path, nums[i], nowRow+1, canJoin, ret)
			path = path[:len(path)-1]
		}
	}

	_ret := make([]int, 0)
	for i := 0; i < len(path); i++ {
		_ret = append(_ret, path[i])
	}
	*ret = append(*ret, _ret)

}

func lengthOfLIS(nums []int) int {
	canJoin := true
	ret := make([][]int, 0)
	back(nums, 0, []int{}, 0, 0, &canJoin, &ret)
	return -1
}
